import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:intl/intl.dart';
import '../util/_base_export.dart';

class AppCard {
  static homeCategoryBanner(Color firstColor, Color secondColor) {
    return BoxDecoration(
        gradient: LinearGradient(
      colors: [firstColor, secondColor],
      begin: Alignment.topCenter,
      end: Alignment.bottomCenter,
    ));
  }
}

class AppTextWidget {
  static categoryBannerText(String iv_text, Color iv_color) {
    return Text(
      iv_text,
      style: TextStyle(
          color: iv_color, fontSize: 24.sp, fontWeight: FontWeight.w600),
      softWrap: true,
      maxLines: 1,
      overflow: TextOverflow.ellipsis,
    );
  }

  static salesBannerTitle(String iv_text) {
    return Text(
      iv_text,
      style: TextStyle(
          color: Colors.white, fontSize: 35.sp, fontWeight: FontWeight.w200),
    );
  }

  static salesBannerDesc(String iv_text) {
    return Text(
      iv_text,
      style: TextStyle(
          color: Colors.white, fontSize: 13.sp, fontWeight: FontWeight.w300),
    );
  }

  static categoryBannerMoreText(String iv_text, Color iv_color) {
    return Text(
      iv_text,
      style: TextStyle(
          color: iv_color, fontSize: 12.sp, fontWeight: FontWeight.w300),
    );
  }

  static originalPriceDelete(String iv_text) {
    return Text(
      iv_text,
      softWrap: true,
      maxLines: 1,
      overflow: TextOverflow.ellipsis,
      style: TextStyle(
        color: Colors.red,
        fontSize: 10.sp,
        decoration: TextDecoration.lineThrough,
      ),
    );
  }

  static priceForSale(String iv_text) {
    return Text(
      iv_text,
      softWrap: true,
      maxLines: 1,
      overflow: TextOverflow.ellipsis,
      style: TextStyle(
        color: Colors.black,
        fontSize: 12.sp,
      ),
    );
  }
}

class AppTextStyle {
  static TextStyle header1Referal = TextStyle(
    fontSize: 34.sp,
    // fontWeight: FontWeight.w100,
    color: Colors.white,
  );
  static TextStyle header2Referal = TextStyle(
    fontSize: 14.sp,
    // fontWeight: FontWeight.w100,
    color: Colors.white,
  );
  static TextStyle code1Referal = TextStyle(
    fontSize: 18.sp,
    color: Colors.black,
  );
  static TextStyle code2Referal = TextStyle(
    fontSize: 24.sp,
    color: Colors.black,
  );
  static TextStyle cup1Referal = TextStyle(
    fontSize: 12.sp,
    color: Colors.white,
  );
  static TextStyle cup2Referal = TextStyle(
    fontSize: 18.sp,
    color: Colors.white,
  );
  static TextStyle cup3Referal = TextStyle(
    fontSize: 24.sp,
    color: Colors.white,
  );
  static TextStyle rankHeaderReferal = TextStyle(
    fontSize: 20.sp,
    color: Color(0xffFF3434),
  );
  static TextStyle rankSubHeaderReferal = TextStyle(
    fontSize: 12.sp,
    color: Color(0xff808080),
  );
  static TextStyle rankTextReferal = TextStyle(
    fontSize: 12.sp,
    color: Colors.black,
  );
  static TextStyle notesSwitch = TextStyle(
    fontSize: 14.sp,
    color: Color(0xff9A9A9A),
  );
  static TextStyle notesButtonSwitch = TextStyle(
    fontSize: 12.sp,
    color: Color(0xff9A9A9A),
  );
  static TextStyle urlButtonSwitch = TextStyle(
    fontSize: 12.sp,
    color: Color(0xff7655FF),
  );

  static TextStyle nameVoucherUsage = TextStyle(
    fontSize: 16.sp,
    color: Colors.black,
  );
  static TextStyle amountVoucherUsage = TextStyle(
    fontSize: 16.sp,
    color: Color(0xff7655FF),
  );
  static TextStyle orderVoucherUsage = TextStyle(
    fontSize: 12.sp,
    color: Colors.black,
  );
  static TextStyle dateVoucherUsage = TextStyle(
    fontSize: 12.sp,
    color: Color(0xff9A9A9A),
  );

  static TextStyle dateMsg = TextStyle(
    fontSize: 12.sp,
    color: Colors.grey,
  );
  static TextStyle subjectMsg = TextStyle(
    fontSize: 15.sp,
    fontWeight: FontWeight.w600,
    color: Colors.black,
  );
  static TextStyle contentMsg = TextStyle(
    fontSize: 12.sp,
    color: Colors.black,
  );

  static TextStyle balanceVoucherList = TextStyle(
    fontSize: 30.sp,
    color: Colors.white,
  );
}

class AppButton {
  static groupApply(String iv_text, VoidCallback iv_pressed) {
    return ElevatedButton(
      style: ElevatedButton.styleFrom(
        primary: Color(0xFFFFB91A),
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(45))),
      ),
      child: Padding(
          padding: EdgeInsets.symmetric(horizontal: 90.w, vertical: 16.h),
          child: Text(
            iv_text,
            style: TextStyle(
              fontSize: 18.sp,
              color: Colors.black,
            ),
          )),
      onPressed: iv_pressed,
    );
  }

  static accountSwitch(
      String iv_text, Color iv_color, VoidCallback iv_pressed) {
    return ElevatedButton(
      style: ElevatedButton.styleFrom(
        primary: iv_color,
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(45))),
      ),
      child: Padding(
          padding: EdgeInsets.symmetric(horizontal: 60.w, vertical: 16.h),
          child: Text(
            iv_text,
            style: TextStyle(
              fontSize: 18.sp,
              color: Colors.white,
            ),
          )),
      onPressed: iv_pressed,
    );
  }
}
